<template>
	<!-- title部分 -->
	<view class="title">
		<view class="title_leftbox" @click="goToWode">
			<image class="title_leftbox_image_fanhui" src="../../static/返回.png"></image>
		</view>
		<view class="title_middlebox">
			<view class="title_middlebox_text">我的合买</view>
		</view>
		<view class="title_rightbox">
			<view class="title_rightbox_text"></view>
		</view>
	</view>

	<!-- biaoqian部分 -->
	<view class="biaoqian">
		<view class="biaoqianbox">
			<view class="biaoqianbox_imgbox">
				<image class="biaoqianbox_imgbox_img" src="../../static/zhgl.png"></image>
			</view>

			<view class="biaoqianbox_nrbox1">
				<view class="biaoqianbox_nrbox1_textbox1">
					<view class="biaoqianbox_nrbox1_textbox1_text">936558</view>
					<image class="biaoqianbox_nrbox1_textbox1_img" src="../../static/vip0.png"></image>
				</view>
				<view class="biaoqianbox_nrbox1_textbox2">
					<view class="biaoqianbox_nrbox1_textbox2_text">粉丝0人</view>
					<view class="biaoqianbox_nrbox1_textbox2_xian"></view>
					<view class="biaoqianbox_nrbox1_textbox2_text">关注0人</view>
				</view>
			</view>

			<view class="biaoqianbox_nrbox2">
				<view class="biaoqianbox_nrbox2_textbox">
					<view class="biaoqianbox_nrbox2_textbox_text1">0元</view>
					<view class="biaoqianbox_nrbox2_textbox_text2">累计中奖</view>
				</view>
				<view class="biaoqianbox_nrbox2_textbox">
					<view class="biaoqianbox_nrbox2_textbox_text1">0元</view>
					<view class="biaoqianbox_nrbox2_textbox_text2">历史最大奖项</view>
				</view>
				<view class="biaoqianbox_nrbox2_textbox">
					<view class="biaoqianbox_nrbox2_textbox_text1">—</view>
					<view class="biaoqianbox_nrbox2_textbox_text2">7日命中</view>
				</view>
				<view class="biaoqianbox_nrbox2_textbox">
					<view class="biaoqianbox_nrbox2_textbox_text1">0人</view>
					<view class="biaoqianbox_nrbox2_textbox_text2">带红人数</view>
				</view>
			</view>
		</view>
	</view>

	<!-- hemai部分 -->
	<view class="hemai">
		<view class="hemaibox">
			<view class="hemaibox_hemaijilu">合买记录</view>
		</view>

		<!-- tab部分 -->
		<view class="tabbox">
			<view class="tabbox_text" v-for="(tab, index) in tabs" :key="index"
				:class="{ 'active': subCurrent === index }" @click="subChecked(index)">
				{{ tab }}
			</view>
		</view>

		<!-- qiehuan部分 -->
		<view v-if="subCurrent === 0" class="content">
			<view class="zhanwubox">
				<image class="zhanwubox_img" src="../../static/zanwu.png"></image>
				<view class="zhanwubox_text">发起的</view>
			</view>
		</view>
		<view v-if="subCurrent === 1" class="content">
			<view class="zhanwubox">
				<image class="zhanwubox_img" src="../../static/zanwu.png"></image>
				<view class="zhanwubox_text">参与的</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				subCurrent: 0, // 默认选中第一个子tab
				tabs: ['发起的', '参与的'],
			}
		},
		methods: {
			goToWode() {
				// 在tabbar中使用uniapp的switchTab方法跳转
				// uni.switchTab({
				// 	url: '/pages/wode/wode', // 我的路径
				// });
				
				// 返回上一个页面
				uni.navigateBack({
				  delta: 1 
				});
			},
			
			subChecked(index) {
				this.subCurrent = index;
			},
		}
	}
</script>

<style>
	page {
		background-color: #f9f9f9;
	}

	/* 以下是title部分样式 */
	.title {
		background-color: rgb(226, 50, 52);
		display: flex;
		align-items: center;
		justify-content: space-between;
		/* 使左右盒子分别位于两侧 */
		padding: 2%;
	}

	.title_leftbox {
		display: flex;
		align-items: center;
		justify-content: center;
		/* 使图标居中 */
	}

	.title_leftbox_image_fanhui {
		width: 17px;
		height: 23px;
	}

	.title_middlebox {
		flex-grow: 1;
		/* 使中间盒子占据剩余空间 */
		display: flex;
		align-items: center;
		justify-content: center;
		/* 使文本居中 */
	}

	.title_middlebox_text {
		font-size: 20px;
		color: white;
		font-weight: 900;
	}

	.title_rightbox {
		display: flex;
		align-items: center;
		justify-content: center;
		/* 使文本居中 */
	}

	.title_rightbox_text {
		color: white;
	}

	/* biaoqian部分样式 */
	.biaoqian {
		margin: 0 auto;
		padding: 2%;
		background: linear-gradient(to bottom, #fe3b52 17%, white);
		height: 26vh;
	}

	.biaoqianbox {
		background: linear-gradient(to bottom, #fe9fa9, white 60%);
		padding-top: 15%;
		margin: 10% auto;
		border-radius: 15px;
		/* height: 23vh; */
		box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
	}

	.biaoqianbox_imgbox {
		display: block;
		position: absolute;
		top: 66px;
		left: 31px;
		background: gainsboro;
		border-radius: 50px;
		border: 1px solid white;
	}

	.biaoqianbox_imgbox_img {
		width: 85px;
		height: 85px;
		display: block;

	}

	.biaoqianbox_nrbox1 {
		position: absolute;
		top: 100px;
		left: 128px;

	}

	.biaoqianbox_nrbox1_textbox1 {
		display: flex;
	}

	.biaoqianbox_nrbox1_textbox1_text {
		font-weight: 900;
		font-size: 20px;
		margin-bottom: 5px;
		margin-right: 5px;
	}

	.biaoqianbox_nrbox1_textbox1_img {
		width: 66px;
		height: 22px;
	}

	.biaoqianbox_nrbox1_textbox2 {
		display: flex;
		align-items: center;
	}

	.biaoqianbox_nrbox1_textbox2_text {
		font-size: 13px;
		color: #444444;
	}

	.biaoqianbox_nrbox1_textbox2_xian {
		width: 1px;
		height: 14px;
		background: black;
		margin: 0 5px;
	}

	.biaoqianbox_nrbox2 {
		display: flex;
		/* padding-top: 5%; */
		flex-wrap: wrap;
		padding: 10% 2% 2% 7%;
	}

	.biaoqianbox_nrbox2_textbox {
		width: 50%;
		padding-bottom: 5%;
	}

	.biaoqianbox_nrbox2_textbox_text1 {
		font-size: 19px;
		color: rgb(34, 34, 34);
	}

	.biaoqianbox_nrbox2_textbox_text2 {
		font-size: 13px;
		color: rgb(136, 136, 136);
	}

	/* 合买部分样式 */
	.hemai {
		margin-top: 20%
	}

	.hemaibox {
		padding: 2%;
	}

	.hemaibox_hemaijilu {
		font-size: 20px;
		padding: 3% 0%;
		font-weight: 900;
	}


	/* 以下是 tab 部分样式 */

	.tabbox {
		display: flex;
		align-items: center;
		background: white;
		height: 45px;
		font-size: 16px;
		background-color: white;
	}

	.tabbox_text {
		flex: 1;
		text-align: center;
		cursor: pointer;
	}

	/* tab被选样式 */
	.active {
		position: relative;
		color: #E23234;
		font-weight: bold;
	}

	.active::after {
		content: "";
		position: absolute;
		width: 23px;
		height: 3px;
		background-color: #E23234;
		left: 0;
		right: 0;
		margin: 0px auto;
		top: 28px;
		border-radius: 5px;
	}

	.content {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 45vh;
	}

	.zhanwubox_img {
		width: 60px;
		height: 60px;
		display: block;
	}

	.zhanwubox_text {
		color: rgb(192, 196, 204);
		font-size: 14px;
	}
</style>
